home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / pc / Demos / Bombardier_PC / BSCRIPTS.CST / 00111_Script_generalRollandJump < prev    next >
Text File  |  1999-04-25  |  5KB  |  184 lines

  1. -- ⌐ 1998 @radical.media, inc. & Concurrent New Media Group, L.L.C.
  2. -- Developed for Bombardier, Inc.
  3. --
  4. -- All programming developed by: 
  5. -- Robert Fabricant, Valerie Valoueva, Ossi Shaked, 
  6. -- Henry Sauvageot, Chris Howell & Chris Girand
  7. --
  8. -- Use of this code by parties other than @radical.media, inc. or their
  9. --agents 
  10. -- without the express written consent of @radical.media, inc. AND Concurrent 
  11. -- New Media Group, L.L.C. is strictly prohibited.
  12. ------------------------------------------------------
  13. --This is a script of a button that takes to a curtain frame defined by #frameName property when cicked. Each button consists of two elements: #bmp "Picture" and #richText "Field". Both elements are linked and should be percieved by user as a whole: one element's rollover triggers the other element's rollover.
  14.  
  15. property mySprite, NeutralName, HiliteName, pictSprite,PictNeuName,PictHilName,frameName, myRect,rolledOver
  16.  
  17.  
  18. on getPropertyDescriptionList
  19.   set description = [:]
  20.   addProp description, #frameName,[#format:#string,¼
  21.                                        #default:"",#comment:"enter the frame name  you wanna go to"]
  22.   return description
  23. end  
  24.  
  25.  
  26. on new me
  27.   global soundPlayed -- rollover sound trigger
  28.   
  29.   set mySprite = the spriteNum of me
  30.   
  31.   set NeutralName = getNeutralName(me, mySprite)
  32.   
  33.   if neutralName contains "field" then
  34.     set PictNeuName = getPictNeuName (me)
  35.     set pictSprite = getSpriteNumFromMemberName (PictNeuName)
  36.     set PictHilName = PictNeuName&"-hil"
  37.     
  38.     --Rollover sound effect shouldn't play again 
  39.     --if mouse leaves "field" and rolles over "Picture" 
  40.     --and vice versa. Boundaries between "field" and "Picture" 
  41.     --sould be seamless. The following code calculates an 
  42.     --imaginary rectangle around the button to set the sound 
  43.     --trigger off if mouse is within that rectangle.
  44.     set textWidth = the width of member neutralName
  45.     set textHeight = the height of member neutralName
  46.     set butWidth = the width of member PictNeuName
  47.     set butHeight = the height of member PictNeuName
  48.     if the left of sprite mySprite > the left of sprite pictSprite then
  49.       set startH = the left of sprite pictSprite - butWidth/2 
  50.       set startV = the top of sprite pictSprite - butHeight/2
  51.     else
  52.       set startH = the left of sprite mySprite 
  53.       set startV = the top of sprite mySprite
  54.     end if
  55.     set startPoint = point(startH,startV)
  56.     set endH = startH + butWidth + textWidth
  57.     set endV = startV + max(butHeight,textHeight)
  58.     set endPoint = point(endH,endV)
  59.     set myRect = rect(startPoint,endPoint)
  60.     
  61.     set soundPlayed = FALSE
  62.     set rolledOver = FALSE --one screen may hane more then one 
  63.                            --of this buttons. By setting and checking 
  64.                            --this property, we make sure that the sound 
  65.                            --trigger is set off for the same button it was set on
  66.     
  67.   else
  68.     set HiliteName = NeutralName&"-hil"
  69.   end if
  70.   
  71.   
  72.   
  73.   
  74. end
  75.  
  76.  
  77. on exitFrame me 
  78.   global soundPlayed
  79.   if neutralName contains "field" then
  80.     set mouseLoc = point(the mouseH, the mouseV)
  81.     if inside (mouseLoc,myRect) then
  82.       set rolledOver = TRUE
  83.       if not soundPlayed then
  84.         puppetsound 3, "subRollOld"
  85.         set soundPlayed = TRUE
  86.       end if
  87.     else
  88.       if rolledOver then
  89.         set soundPlayed = FALSE
  90.         set rolledOver = FALSE
  91.       end if
  92.       
  93.     end if
  94.   end if
  95.   
  96.   
  97.   
  98. end
  99.  
  100.  
  101. on mouseWithin me
  102.   if neutralName contains "field" then
  103.     set the member of sprite pictSprite = member  PictHilName
  104.   else
  105.     set the member of sprite mySprite = member  hiliteName
  106.   end if
  107.   updatestage
  108. end
  109.  
  110. on mouseLeave me
  111.   if neutralName contains "field" then
  112.     set the member of sprite pictSprite = member  PictNeuName
  113.   else
  114.     set the member of sprite mySprite = member  NeutralName
  115.   end if
  116.   
  117. end
  118.  
  119. on mouseUp me
  120.   global  cockpitRetFrame
  121.   puppetsound 1, "mouse5"
  122.   
  123.   cursor -1 
  124.   if not(NeutralName contains "print") then
  125.     if frameName = "" then
  126.       go to frame cockpitRetFrame 
  127.     else
  128.       go to frame frameName
  129.     end if
  130.   end if
  131.   
  132.   set gContollerList = []
  133.   
  134. end
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141. on getNeutralName me,SpriteNum
  142.   
  143.   set aMember = the member of sprite spriteNum
  144.   set Name = the name of member aMember
  145.   if Name contains "-" then
  146.     repeat with i = the Number of Chars of Name down to 1
  147.       if char i of Name <> "-" then 
  148.         delete char i of Name
  149.       else
  150.         delete char i of Name
  151.         exit repeat
  152.       end if
  153.     end repeat
  154.   end if
  155.   
  156.   
  157.   return Name
  158.   
  159. end
  160.  
  161.  
  162. on getPictNeuName me
  163.   set Name = neutralName
  164.   
  165.   repeat with i = the Number of Chars of Name down to 1
  166.     if char i of Name <> "_" then 
  167.       delete char i of Name
  168.     else
  169.       delete char i of Name
  170.       exit repeat
  171.     end if
  172.   end repeat
  173.   
  174.   
  175.   
  176.   return Name
  177. end
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.